import service from '@/utils/request'
export const login = (data) => {
  return service({
    url: '/manager/account/login',
    method: 'post',
    data: data
  })
}

// @Summary 修改密码
// @Produce  application/json
// @Param data body {username:"string",password:"string",newPassword:"string"}
// @Router /user/changePassword [post]
export const changePassword = (data) => {
  return service({
    url: '/user/changePassword',
    method: 'post',
    data: data
  })
}

export const getUserList = (params) => {
  return service({
    url: '/manager/account/list',
    method: 'get',
    params
  })
}

export const deleteUser = (id) => {
  return service({
    url: `/manager/account/delete/${id}`,
    method: 'post'
  })
}

export const createUser = (data) => {
  return service({
    url: '/manager/account/add',
    method: 'post',
    data: data
  })
}

export const editUser = (data) => {
  return service({
    url: '/manager/account/edit',
    method: 'post',
    data: data
  })
}

export const modifyPassword = (data) => {
  return service({
    url: '/manager/account/modify/password',
    method: 'post',
    data: data
  })
}

export const userList = (params) => {
  return service({
    url: '/manager/user/list',
    method: 'get',
    params
  })
}

export const allocationSpot = (data) => {
  return service({
    url: '/manager/user/allocation/spot',
    method: 'post',
    data: data
  })
}
